<template>
  <div class="div">
    <div class="box" v-for="(v, i) in arr" :key="i">
      <img :src="v.img" />
      <div>
        <p>{{ v.text | sangedian }}</p>
        <p>{{ v.range }}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  filters: {
    sangedian(val) {
      if (val.length > 9) {
        return val.substr(0, 9) + "...";
      } else {
        return val;
      }
    },
  },
  data() {
    return {
      arr: [
        {
          id: 222,
          img: "./img/life/erjiluyou2.png",
          text: "陕西特产·巨鹰",
          range: "1.15km",
        },
        {
          id: 444,
          img: "./img/life/erjiluyou2.png",
          text: "陕西特产·巨鹰",
          range: "1.15km",
        },

        {
          id: 666,
          img: "./img/life/erjiluyou2.png",
          text: "陕西特产·巨鹰",
          range: "1.15km",
        },
      ],
    };
  },
  
};
</script>

<style lang="scss" scoped>
.div {
  display: flex;
  justify-content: left;
  flex-wrap: wrap;
  > .box:nth-child(2n-1) {
    margin: 0.1rem 0.1rem 0.1rem 0;
  }
  > .box:nth-child(2n) {
    margin: 0.1rem 0rem 0.1rem 0.1rem;
  }
  > .box {
    width: 46%;
    background-color: #dff;
    > img {
      width: 1.65rem;
      opacity: 0.5;
    }
    > div {
      padding: 0rem 0.05rem;
      line-height: 0.25rem;
      > p:nth-child(1) {
        font-size: 0.14rem;
      }
      > p:nth-child(2) {
        font-size: 0.12rem;
        color: #999;
      }
    }
  }
}
</style>